package com.example.springboot.admin.controller;

import com.example.springboot.admin.entity.SysUser;
import com.example.springboot.admin.service.SysUserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (SysUser)表控制层
 *
 * @author liubao
 * @since 2020-06-16 14:44:20
 */
@RestController
@RequestMapping("sysUser")
public class SysUserController {

    /**
     * 服务对象
     */
    @Resource
    private SysUserService sysUserService;

    /**
     * 根据用户名查找用户
     * @return
     */
    @GetMapping("findByName")
    public SysUser findByName(String username) {
        return sysUserService.findByName();
    }

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public SysUser selectOne(Long id) {
        return sysUserService.queryById(id);
    }

    /**
     * 查询全部的用户信息
     * @return
     */
    @PostMapping("/queryAllPage")
    public List<SysUser> queryAllPage(){
        return sysUserService.queryAllPage();
    }
}